<template>
    <div class="table_box">
        <el-table :data="tableData" class="com_table" ref="straRef" height="700px">
            <div slot="empty" class="flexbox flexcenter flexcolumn flexjust" style="height:700px">
                <img src="../../assets/img/null_icon.svg" alt="">
                <div class="font_13 color_03">暂无数据</div>
            </div>
            <el-table-column prop="material_name" label="素材名称" min-width="450"></el-table-column>
            <el-table-column prop="material_id" label="素材ID" min-width="200"></el-table-column>
            <el-table-column prop="examine" label="审核状态" min-width="250">
                <template slot-scope="scope">
                    <div class="pf_tag flexbox flexcenter blue2" v-if="scope.row.examine==0">
                        <img src="../../assets/img/pf_tag6.svg" alt="">
                        等待审核
                    </div>
                    <div class="flexbox flexcenter" v-else-if="scope.row.examine==-1">
                        <div class="pf_tag flexbox flexcenter red">
                            <img src="../../assets/img/pf_tag7.svg" alt="">
                            审核失败
                        </div>
                        <div class="passData" @click="passData(scope.row)">手动通过</div>
                    </div>
                    <div class="pf_tag flexbox flexcenter gray" v-else-if="scope.row.examine==1">
                        <img src="../../assets/img/pf_tag9.svg" alt="">
                        审核中
                    </div>
                    <div class="flexbox flexcenter" v-else-if="scope.row.examine==-2">
                        <div class="pf_tag flexbox flexcenter red">
                            <img src="../../assets/img/pf_tag7.svg" alt="">
                            计划创建失败
                            <el-tooltip class="item" effect="dark" :content="scope.row.err_msg" placement="top">
                                <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin: 0 5px">
                                    <circle cx="8.0001" cy="8.0001" r="6.4" fill="#FE6262" />
                                    <path d="M5.9225 7.08352V7.16102H6H6.99563H7.07313V7.08352C7.07313 6.72217 7.14183 6.45117 7.27644 6.26785L7.27649 6.26788L7.27824 6.2653C7.42501 6.04757 7.66655 5.93904 8.03493 5.93904C8.31788 5.93904 8.53089 6.01405 8.67791 6.16157C8.81899 6.31189 8.90067 6.52012 8.90067 6.79341C8.90067 6.99313 8.82971 7.18698 8.68277 7.36802L8.58191 7.48647C8.29889 7.74082 8.07109 7.9613 7.89921 8.14872C7.72809 8.33532 7.60833 8.49349 7.54631 8.62266C7.41684 8.87452 7.36355 9.17772 7.36355 9.51868V9.64176V9.71926H7.44105H8.44542H8.52292V9.64176V9.51868C8.52292 9.31929 8.56398 9.14651 8.64583 8.98173C8.71972 8.83297 8.82661 8.69202 8.97557 8.56707L8.97559 8.56709L8.97699 8.56585C9.39516 8.19754 9.65231 7.95692 9.73463 7.86484L9.73486 7.86505L9.739 7.85949C9.96021 7.56261 10.0775 7.18516 10.0775 6.73187C10.0775 6.17729 9.89601 5.73281 9.52761 5.40813C9.16053 5.07579 8.67741 4.9225 8.09607 4.9225C7.43436 4.9225 6.90673 5.112 6.51367 5.49827C6.1106 5.88574 5.9225 6.41798 5.9225 7.08352ZM8.46546 10.5324L8.46549 10.5323L8.46355 10.5305C8.31677 10.3926 8.13125 10.3249 7.9214 10.3249C7.71051 10.3249 7.53405 10.3933 7.38798 10.5305C7.23919 10.6703 7.17141 10.8501 7.17141 11.0617C7.17141 11.2733 7.23919 11.4531 7.38798 11.5929C7.53211 11.7283 7.70789 11.8073 7.9214 11.8073C8.13228 11.8073 8.30874 11.7389 8.45481 11.6017C8.60253 11.4629 8.68012 11.2749 8.68012 11.0617C8.68012 10.8477 8.60204 10.6699 8.46546 10.5324Z" fill="white" stroke="white" stroke-width="0.155" />
                                </svg>
                            </el-tooltip>
                        </div>
                        <div class="passData" @click="rePeat(scope.row)">重试</div>
                        <div class="passData" @click="passData2(scope.row)" style="margin-left:10px">手动通过</div>
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
import "@/assets/css/video.css";
export default {
    props: ["tableData"],
    name: "",
    data() {
        return {};
    },
    created() {},

    methods: {
        // 通过
        passData(row) {
            this.$confirm(
                "通过后该素材将进入一阶测试，请确认！",
                "是否审核通过",
                {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                }
            )
                .then(async () => {
                    const { data: res } = await this.$http.post(
                        "videotest/Probject/materialEdit",
                        {
                            id: row.id,
                        }
                    );
                    if (res.code !== 200) {
                        this.$message.error(res.msg);
                        return;
                    } else {
                        this.$message({
                            type: "success",
                            message: "操作成功!",
                        });
                        this.$emit("getDataList");
                    }
                })
                .catch(() => {});
        },

        passData2(row) {
            this.$emit("passData2",row.id)
        },

        //重试
        async rePeat(row) {
            var { data: res } = await this.$http.post(
                "videotest/Probject/materialPlanEdit",
                {
                    id: row.id,
                }
            );
            if (res.code !== 200) {
                this.$message.error(res.msg);
                return;
            } else {
                this.$message({
                    type: "success",
                    message: "操作成功!",
                });
                this.$emit("getDataList");
            }
        },
    },
    components: {},
};
</script>


<style scoped>
.pf_tag {
    margin-right: 12px;
}
.table_box {
    padding: 0 20px;
}
</style>
